#ifndef _RMRAUTO_
#define _RMRAUTO_
#include "WPILib.h"
#include "RMRDrive.h"
#include "RMRIO.h"



/*
 * RMRAuto.h
 * 
 * Declaration of class RMRAuto
 * 
 * Manages autonomous code
 */

class RMRAuto
{
public:
	// constructor
	RMRAuto(Watchdog &watchdog, RMRDrive &rmrDrive);
	
	//Initialize hardware we need before autonomous
	void initHardware();
	
	// drive straight at the given speed (in wheel rotation per second) for the given time (in seconds)
	//Returns either when time is up or on exiting autonomous mode
	void DriveStraight(float speed, float time);
	
	//Turn at the given turn(in terms of -1.0 = left, 1.0 = right) at the given speed (in wheel rotation per second) for the given time (in seconds)
	//Returns either when time is up or on exiting autonomous mode
	void Turn(float turn, float speed, float time);
	
	//Pause for the given time in seconds, Returns either when time is up or on exiting autonomous mode
	void Pause(float time);
	
	//Get the autonomous setting
	int GetAutoSelect();
	
	
	/*
	 * Constants
	 */
	
	//Range boundries for randomly generated autonomous moves
	static const float AUTO_MIN_SPEED = 0.0;
	static const float AUTO_MAX_SPEED = MAX_ROBOT_SPEED; // from a #define in RMRDrive.h
	static const float AUTO_MIN_TIME = 0.5;
	static const float AUTO_MAX_TIME = 4.0;
	static const float AUTO_MIN_TURN = -1.0;
	static const float AUTO_MAX_TURN = 1.0;


	
private:
	// timer to measure how long a command has been running
	Timer m_timer;
	
	// watchdog, so we can feed it during a command
	Watchdog &m_watchdog;
	
	// RMRDrive - we call the CarDrive(speed, turn) method
	RMRDrive &m_rmrDrive;
	
	// pointer to DriverStation for the IsAutonomous() method
	DriverStation *m_ds;
	
	// digital inputs for autonomous mode selection
	DigitalInput m_auto_code_1;
	DigitalInput m_auto_code_2; 
	
};

#endif
